﻿#if UNITY_EDITOR
using System;
using UnityEngine;
/// <summary>
/// GUI绘制枚举
/// </summary>
[Flags]
public enum ESF_enGUIDrawClassify
{
    /// <summary>
    /// 所有操作按钮
    /// </summary>
    [ESF_AliasTooltip("All")]
    All = int.MaxValue,
    /// <summary>
    /// 普通绘制
    /// </summary>
    [ESF_AliasTooltip("Normal")]
    Normal = 0,
    /// <summary>
    /// 条件绘制
    /// </summary>
    [ESF_AliasTooltip("CondDraw")]
    CondDraw = 1 << 0,
}

/// <summary>
/// GUI操作按钮特性
/// </summary>
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class ESF_GUIDrawAttribute : PropertyAttribute
{
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="_classify">绘制分类</param>
    public ESF_GUIDrawAttribute(ESF_enGUIDrawClassify _classify = ESF_enGUIDrawClassify.Normal)
    {
        classify = _classify;
    }

    /// <summary>
    /// 是否包含指定操作
    /// </summary>
    /// <param name="_classify">绘制分类</param>
    /// <returns>true:是,false:否</returns>
    public bool hasDraw(ESF_enGUIDrawClassify _classify)
    {
        return (classify & _classify) == _classify;
    }

    /// <summary>
    /// 操作
    /// </summary>
    public ESF_enGUIDrawClassify classify { get; private set; }
}
#endif
